package com.thingsgrid.mqtthelper.config;

import org.springframework.integration.mqtt.core.MqttPahoClientFactory;
import org.springframework.integration.mqtt.inbound.MqttPahoMessageDrivenChannelAdapter;

/**
 * 功能说明：实例化adapter
 *
 * @author 李龙飞
 * @since 2019/8/26 15:10
 */
public class MqttAdapterConfig {

    private static MqttPahoMessageDrivenChannelAdapter adapter;

    public static MqttPahoMessageDrivenChannelAdapter getInstanceAdapter(String clientId, MqttPahoClientFactory clientFactory, String... topic){
    	if(null==adapter){
			adapter = new MqttPahoMessageDrivenChannelAdapter(clientId,clientFactory,topic);
		}
		return adapter;
    }

    public static MqttPahoMessageDrivenChannelAdapter getInstanceAdapter(){
        return adapter;
    }


}
